{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf320
{\fonttbl\f0\fnil\fcharset0 Verdana;}
{\colortbl;\red255\green255\blue255;\red255\green0\blue0;\red161\green33\blue108;}
\deftab480
\pard\pardeftab480\ql\qnatural\pardirnatural

\f0\fs28 \cf0 Template files are processed line by line when generating a parser. The processing is done in the following order:\
1) Conditional method inclusion is peformed. If the method should be omitted all of the lines up to and including the end of method marker and omitted.\
2) Conditional line inclusion is performed.\
3) Code injection is performed.\
4) Text replacement is done for a few identifiers like PARSER and VALUE.\
\
All of this (except text replacement) is done via special comments:\
\

\b Conditional Method Inclusion\

\b0 \cf2 //< name predicate?\cf0 	begin method marker\
\cf2 //> name\cf0 				end method marker\
If the predicate is missing or evaluates to true and name is not an excluded method then all of the lines between the begin and end markers are filtered in.\
\

\b Conditional Line Inclusion\

\b0 \cf2 // predicate\
\cf0 If the predicate is false then the line is filtered out.\
\

\b Code Injection\

\b0 \cf2 /* text predicate? */\cf0 	C based languages	\
\cf2 (* text predicate? *)\cf0 	F#\
This is done by trimming the body of the comment and evaluating the predicate. If there is no predicate or the predicate evaluates to true then the comment is replaced with the text. Otherwise the comment is removed.\
\

\b Predicates\

\b0 \cf2 \{\{expression\}\}\cf0 \
Predicate expressions are as follows:\
\
\pard\pardeftab480\ql\qnatural\pardirnatural
\cf0 Predicate := OrExpression\
\
OrExpression := AndExpression (\cf3 'or'\cf0  SS AndExpression)+	\
OrExpression := AndExpression\
\
AndExpression := EqualityExpression (\cf3 'and'\cf0  SS EqualityExpression)+\
AndExpression := EqualityExpression\
\
EqualityExpression := NotExpression \cf3 '=='\cf0  S NotExpression\
EqualityExpression := NotExpression \cf3 '!='\cf0  S NotExpression	\
EqualityExpression := NotExpression\
\
NotExpression := \cf3 'not'\cf0  SS PrimaryExpression\
NotExpression := PrimaryExpression\
\
PrimaryExpression := \cf3 '('\cf0  S Predicate \cf3 ')'\cf0  S\
PrimaryExpression := Literal\
PrimaryExpression := \cf3 'excluded'\cf0  SS \cf3 '('\cf0  S Literal \cf3 ')'\cf0  S\
PrimaryExpression := Variable\
\
Literal := \cf3 "'"\cf0  \cf3 [^'\\n\\r]\cf0 * \cf3 "'"\cf0  S	\
Literal := \cf3 'true'\cf0  SS\
Literal := \cf3 'false'\cf0  SS\
\
Variable := VariablePrefix VariableSuffix* S\
VariablePrefix := \cf3 [a-zA-Z_]\cf0 \
VariableSuffix := \cf3 [a-zA-Z0-9_-]\cf0 \
\pard\pardeftab480\ql\qnatural\pardirnatural
\cf0 \
Expressions operate on boolean values except for the equality expressions which can operate on booleans or strings. Variables may be boolean or string valued. All of the settings are backed by variables and there are a handful of additional variables, including:\
\

\i debugging
\i0 : true if debug setting is not none\

\i has-debug-file
\i0 : true if debug-file setting was used\
}